"Bubble Down" (or siftDown) is the algorithm for restoring the heap property after replacing the root.

  • Compare the current node with its children.
  • If it is smaller than one or both children, swap it with its largest child.
  • Repeat this process, moving down the tree, until the node is larger than both its children, or it becomes a leaf.
3 19 100 17 5 25 1
Array Representation